package Demo5;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86136
 * Date: 2024-05-26
 * Time: 21:13
 */
public class OutClass {
    private int a = 1;
    public int b = 2;
    public static int c = 3;
    public class InnerClass {
        OutClass outClass = new OutClass();
        private int b = 7;
        private int d = 4;
        public int e = 5;
        public static int f = 6;

        public void test() {
            System.out.println(a);
            System.out.println(outClass.b);//2
            System.out.println(OutClass.this.b);//2
            System.out.println(this.b);//7
            System.out.println(c);
            System.out.println(d);
            System.out.println(e);
            System.out.println(f);
            System.out.println("test()...");
        }
    }
}
class OutClass1 {
    private int a = 1;
    public int b = 2;
    public static int c = 3;

    static class InnerClass1 {
        public int b = 7;
        private int d = 4;
        public int e = 5;
        public static int f = 6;

        public void test1() {
            OutClass outClass = new OutClass();
            System.out.println(outClass.b);//2
            System.out.println(b);//7
            System.out.println(c);
            System.out.println(d);
            System.out.println(e);
            System.out.println(f);
            System.out.println("test1()...");

        }

    }
}

class Test1 {
    private int a = 1;
    public int b = 2;
    public static int c = 3;

    public void method() {
        //局部内部类
        class Inner {
            public int b = 7;
            private int d = 5;
            public static int e = 6;
            public void test2() {
                System.out.println("test2()...");
            }
        }
        Inner inner = new Inner();
        inner.test2();
        System.out.println(a);
        System.out.println(b);
        System.out.println(c);
    }
}
